Repository navigation
feat(organizations-test): add the public part - #1399
Merged
Merged
Conversation
`organizations-test --part public` proves an organization's public namespace: both namespaces with their labels and the operator's everyone binding; a person of another organization lists, starts and calls the organization's public agent and MCP server; an editor cannot publish; an empty public namespace is named nowhere; a public write in mode commit lands under the public path; the Slack start of a public agent. Part of giantswarm/giantswarm#39646
…muster's outbound guard - The lab lists the fixture's Service in muster.outbound.privateHosts with platform.organizations on agent-platform 4.190.0-rc.2 or later, and the public part refuses to start, naming the fix, while muster does not list it. - The Slack check runs where the lab runs klaus-gateway or the run names one; elsewhere it is a SKIP. - The agent's turn is judged in its own window of muster's log, without the proof's own start_session and delete_session. - A kustomization's bases, and paths under public, count as listing public. - The pull request of the mode-commit write is closed on every path.
1 of 6 tasks
…blic write needs The public part's mode-commit verdicts run in order: a public write is refused (conflict) while agentlab-b's content path in the proof repository has no kustomization file; the part then adds that kustomization.yaml through a pull request it merges, listing the path's directories and YAML files and never public; then the public write lands under <content path>/public only. The part writes only in a proof repository, removes the file it wrote in an earlier run first, and leaves a kustomization file it did not write as it is.
With agent-manager 4.2.0-rc.9 or later (move_agent), else a SKIP: - agentlab-b's admin moves a private agent to its public namespace; the dry run names the admin's own Session and counts or states other people's; a person who is no member then starts a Session on it with public: true; - the admin moves it back: the person's start with public: true starts no Session and ends as not_found within two minutes (the refusals before it are named as a window), the person holds no live Session of it, and without public it reads as for an organization that does not exist; - an editor's move is refused by the API server, nothing deleted.
… back
After the move back, the person's start with public: true passes as any
refusal that starts no Session, while they hold no live Session of the
agent; the verdict names the code it saw. kagent answers a deleted Agent
with conflict ("Agent does not have a ready prepared revision") for at
least two minutes, where agent-manager would say not_found
(giantswarm/giantswarm#39727).
The editor's twin of the move now passes on any `forbidden` from the API server that names the editor, at whatever step agent-manager meets it: its read of the target as the person (seen in the live run) or its dry run. The words "nothing was written" are no longer required. The check reads the after-state right after the call, before the part's cleanup: the private HelmRelease is the same object (same UID) and not being deleted, and the public namespace holds no copy.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of giantswarm/giantswarm#39646
Problem
From agent-platform-operator 0.7 every organization has a public namespace,
public-agents-<name>, besideagents-<name>. The organization uses it to share agents and MCP servers with every person on the installation. agent-manager reaches the public namespace withpublic: true(giantswarm/agent-manager#528, #529), and klaus-gateway starts a public agent from Slack (giantswarm/klaus-gateway#656).agentlab organizations-testdid not prove any of this.Change
organizations-test --part publicis a new part. Like the other parts, it runs alone. It uses the proof's organizations and members: alice is a member ofagentlab-aand no member ofagentlab-b, bob is an editor ofagentlab-b. The admin ofagentlab-b(the lab's admin) publishes in the public namespace: a model, an agent (create_agentwithpublic: true) and an MCP server. The same MCP server is also in the organization namespace ofagentlab-b. The verdicts:Kubernetes: both namespaces exist with the organization's name and UID labels. Only the public namespace has
space: public. The public namespace has the operator'sagent-platform:everyonebinding toagent-platform:platform-user. Access reviews as alice allowlist agentsandcreate sessionsin the public namespace ofagentlab-b, and denylist agentsin its organization namespace.An editor cannot publish: bob's create in the public namespace is refused (RBAC 403), and his
create_agentwithpublic: trueis refused too. The twins are admitted: bob's create in his own organization namespace, and the admin's create (dry runs).list_agentswithpublic: truelists the public agent ofagentlab-b, withorganizationandpublic: true, and shows its namespace inpublicNamespaces. It does not show the empty public namespace ofagentlab-a: alice may list that namespace, and it holds no agent and no MCPServer.start_sessionwithorganizationandpublic: truestarts a Session on the public agent, created by alice. The twin: withoutpublic, the organization reads word for word as an organization that does not exist. A turn on the public agent answers.muster: alice sees the public server of
agentlab-b, and does not see the same server in its organization namespace. bob sees that one.Toolset: alice's agent in
agentlab-ahas a toolset that namesserver:<public namespace of agentlab-b>/agentlab-public-mcp. With that toolset (theX-Muster-Toolsetheader), alice's catalogue holds the server's tool. The call reaches the server, and muster logs the call under alice's subject. With the toolset that names the private copy, muster refuses the call for alice and answers it for bob. A turn on her agent calls the public server. In the turn's own time window, muster logs her credential and her tool calls.Mode commit, where the lab runs it into one of
platform.workspaces.github.proofRepositories. The part writes in no other repository. It runs in this order:agentlab-b(<content prefix>/agentlab-b) has no kustomization file there, a publiccreate_agentin mode commit is refused withconflict, as agent-manager refuses it. No pull request opens and nothing is live.kustomization.yamlthrough a pull request that it opens and merges with this host'sghlogin, as the credentials part merges its own. The file lists the path's directories and YAML files and neverpublic.<content path>/public. On its branch, the content path's kustomization file does not listpublic. The part closes that pull request.The file starts with a marker comment, and the next run removes it before it proves the refusal again. A kustomization file that the part did not write stays as it is: step 1 is then a SKIP, and step 3 runs against that file.
Slack, where the lab runs klaus-gateway: alice's roster names the public agent
agentlab-b · Public. When she selects it, the conversation answers in a Session that she created.The move (agent-manager's
move_agent, feat(agents): move an organization's agent between its organization and public namespace agent-manager#531, v4.2.0-rc.9). On an older agent-manager these three verdicts are a SKIP that names the release.agentlab-bcreates a private agent there, and the admin and bob each start a Session on it. The dry run ofmove_agentwithto: publicnames the admin's own Session. It counts bob's Session, or states that other people's Sessions go too. The move writes the agent in the public namespace and deletes it from the organization namespace. alice then starts a Session on it withorganizationandpublic: true.to: private), and alice cannot start a Session on it. When the HelmRelease and the Agent are gone from the public namespace, her start withpublic: truemust be refused, with whatever code. She must then hold no live Session of the agent, read as she lists her own. The verdict names the code it saw. For a deleted Agent, kagent still answersconflict: ... Agent does not have a ready prepared revisionwhere agent-manager would answernot_found(giantswarm/giantswarm#39727). Withoutpublic, her start reads word for word as for an organization that does not exist.forbiddenthat names him, at whatever step agent-manager meets it (its read of the target as him, as in the live runs, or its dry run). Read right after the call, before the part's cleanup, the HelmRelease is the same object (same UID) and is not being deleted, and the public namespace holds none.How the part refuses or skips
config.DefaultChartVersionto a stable release, which Renovate updates. A lab runs the operator's 0.7 line from agent-platform 4.190.0-rc.8. agent-manager 4.2.0-rc.x needs aplatform.valuesFilesoverlay (gitops.prereleases).muster.outbound.privateHostslists its host. The lab now renders the host of the fixture's Service there, whenplatform.organizationsis on and the chart is from that release (HACKS.md U53). The part refuses to start, and names the fix, when muster's configuration does not list the host. Afteragentlab platform, muster restarts once (rolls) on such a lab.The fixture and the other code changes
--anonymousmode, in a container on thekindnetwork. muster gives a server outside its own namespace no identity, so the person's identity is checked at muster. The container needs a static Linux agentlab: on macOS, pass one with the new flag--mcp-fixture-binary.organizationStateFromnow readsstatus.capabilities.agentPlatform.publicNamespace.releaseBeforeis extracted fromshapeProblem, andgithubGrantProblemfrom the credentials part.organizationsSlack.start, so the public part reuses it.docs/agents.md"The public part",docs/cli.md, the--parthelp, AGENTS.md and HACKS.md U53.Tests
internal/lab/organizationstest_public_test.go:list_agentsanswer, and the Slack row<organization> · Public;resources,bases,components, paths underpublic);kustomization.yamlthat the part writes (from GitHub's listing of the path, with the marker, neverpublic), and that the part writes only in a proof repository;publicpart name, the public namespace in the Organization's status,muster.outbound.privateHostsin the rendered values (only from the chart floor, and only with organizations on), and the anonymous fake.go test ./...has six failures, the same before and after the fixes. They are in tests that this change does not touch: workspace and coding shell-script tests andTestEnterLabSettlesTheLabHere, which use macOS paths and BSD tools.GOOS=linux make lint(as CI runs it) reports 0 issues.KUBECONFIG=<lab>/state/kubeconfig agentlab organizations-test --part public --mcp-fixture-binary <static linux/arm64 agentlab> --gateway-image gsoci.azurecr.io/giantswarm/klaus-gateway:4.21.0-rc.3.KUBECONFIGis set because the lab'saiKey.sourcenames a context of that kubeconfig.status.capabilities.agentPlatform.publicNamespace, so the API server dropped the operator's value. fix(helm): bundle organization-operator v2.3.0's Organization CRD, which keeps the public namespace in the status agent-platform#1573 (chart 4.190.0-rc.11) fixes this.list_agentswithpublic: true, the empty namespace,start_sessionwithpublic: trueand its twin, the public turn, muster's listing, the toolset under alice's subject and the agent's turn that calls the public server. The Slack start passed. Both GitHub checks were a SKIP, because this lab has no commit mode.public: trueis refused and starts no Session, but kagent answersconflict: kagent: a session of agent public-agents-agentlab-b/agentlab-organizations-moved: Agent does not have a ready prepared revision, notnot_found. In run 3 that answer came about 2 seconds after the move back. In run 4 every one of 60 starts over 2m1s got it, while the agent's HelmRelease and Agent were already gone, so kagent's answer for a deleted Agent stays wrong for at least 2 minutes. The cause is filed as giantswarm/giantswarm#39727: kagent maps the not-found of a deleted Agent to FailedPrecondition, and agent-manager shows that asconflict. Decision (c): the check now accepts any refusal that starts no Session, while alice holds no live Session of the agent, and the verdict names the code that it saw.conflict(giantswarm/giantswarm#39727).forbidden: get helmrelease public-agents-agentlab-b/agentlab-organizations-moved: ... User "oidc:bob@lab.local" cannot get resource "helmreleases" ... in the namespace "public-agents-agentlab-b") at agent-manager's first read of the target, before any write. The check expected the dry run's words "nothing was written".forbiddenfrom the API server that names bob, at any step, with the after-state read before the cleanup.public: truewas refused withconflict(kagent: ... Agent does not have a ready prepared revision, giantswarm/giantswarm#39727), and she held no live Session of the agent. Withoutpublic, the answer wasnot_found, as for an organization that does not exist.forbidden: get helmrelease public-agents-agentlab-b/agentlab-organizations-moved: ... User "oidc:bob@lab.local" cannot get resource "helmreleases"). Afterwards the HelmRelease was the same object (same UID) and not being deleted, andpublic-agents-agentlab-bheld none.Review
start_sessionanddelete_sessionas alice; the turn now has its own window in muster's log.basesand paths underpublic.gh pr merge --delete-branchfails where the proof repository's base requires a merge queue: #1398.move_agentwhose image tag cannot tell its version (a digest, a local tag) fails the move checks instead of skipping them: #1398.not_foundthat never reached kagent (muster's own) would still be worded as kagent's stale answer; cosmetic, the verdict prints the refusal's own text.